package com.yan.demo.method;
// 漂亮打印数组
public class MethodDemo1 {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5};
        m1(arr);
        System.out.println();
        System.out.println("--------------------");
        int[] arr1 = {123,234,546,676,-344};
        m1(arr1);
    }
    // 定义m1方法用来漂亮打印数组
    public static void m1(int[] arr){
        System.out.print("[");
        for (int i = 0; i < arr.length; i++) {
            if(i == arr.length - 1){
                System.out.print(arr[i]);
            } else {
                System.out.print(arr[i] + " ");
            }
        }
        System.out.print("]");
    }
}
